#ifndef __GAME_PAGE_H__
#define __GAME_PAGE_H__

#include "game_manager.h"

class GameManager;

class GamePage : public BasePage
{

    GamePage(Snake *s, Lcd *lcd, ShowFont *showFont, GameManager *gameManager)
        : snake(s), lcd(lcd), showFont(showFont), gameManager(gameManager),
          up_w("./res/up_w.bmp"), down_w("./res/down_w.bmp"), left_w("./res/left_w.bmp"), right_w("./res/right_w.bmp"),
          up_b("./res/up_b.bmp"), down_b("./res/down_b.bmp"), left_b("./res/left_b.bmp"), right_b("./res/right_b.bmp")
    {
    }

public:
    // 重写基类方法
    bool handleTouch(const Point &touch_point) override;
    void show() override;
    void hide() override;

    void toolbarInit();  // 创建工具栏
    void showInfo();     // 显示信息
    void showGameOver(); // 显示游戏结束

    // 创建和删除实例
    static GamePage *instance(Snake *snake, Lcd *lcd, ShowFont *showFont, GameManager *gameManager);
    static void delInstance();

private:
    static GamePage *m_instance; // 单例模式
    Snake *snake;
    Lcd *lcd;
    ShowFont *showFont;
    GameManager *gameManager;
    BMP up_w, down_w, left_w, right_w;
    BMP up_b, down_b, left_b, right_b;
};

#endif